UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZmvJY4zcw9Id66ThIdju78z45JZFZPGYv8tYX99lf+o='
WHERE
key_id = '9514660228b8a7b6f5bb51d8efee404488e5835c738cd3087bd793c8943f6dca'
AND (
token = 'ZmvJY4zcw9Id66ThIdju78z45JZFZPGYv8tYX99lf+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)