UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tb0F6664dIr6Wg6GhMfB6/Xlx9NWyQhRkroEOnW9A3w='
WHERE
key_id = '4ad82f9b074a297c169eab50f41a05268bb8fa4da73c4ba9be8625a9018729ee'
AND (
token = 'tb0F6664dIr6Wg6GhMfB6/Xlx9NWyQhRkroEOnW9A3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)