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