UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JGT8k39AcvJwafbb31Ly9HLAPNSgG+ZisS+7cmlqc5I='
WHERE
key_id = 'c3834807d869650451cd8794706ed5391215153bf92c23375b3f88e42fcbedd7'
AND (
token = 'JGT8k39AcvJwafbb31Ly9HLAPNSgG+ZisS+7cmlqc5I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)