UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z81eDyEf+2NcKVURSmE5/Q+im+VxncCJKy+eN8VMuTM='
WHERE
key_id = 'a1f59456e4ec363d4cdb0e4c981f494c7a90f1a196c574e339556e1196df33fe'
AND (
token = 'z81eDyEf+2NcKVURSmE5/Q+im+VxncCJKy+eN8VMuTM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)