UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AeOWs3YRJgbRWiEcyFQTi365ovNMdkTuHNTocI3esRI='
WHERE
key_id = 'ee996753203e5de2497218a822521dd3afcd3e6f7a7a150aa743ab4a6cecacc8'
AND (
token = 'AeOWs3YRJgbRWiEcyFQTi365ovNMdkTuHNTocI3esRI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)