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