UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9z0YxAMsXCcfOsAZYL3ude52ZKqD0kJrGZLWvwSHqd0='
WHERE
key_id = 'd1d182063059f09dc043c6991b30b93d973a5fe50010b621d24938d5fe8a571a'
AND (
token = '9z0YxAMsXCcfOsAZYL3ude52ZKqD0kJrGZLWvwSHqd0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)