UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Em0CSDUHgDLIEt0hWQWAqJ2wPdy1QDK6NBIw7pQatyI='
WHERE
key_id = '8331830c497fb0c18013a5d25bf1a784d18dde8df30e8c65f2b4810fcfeffd5e'
AND (
token = 'Em0CSDUHgDLIEt0hWQWAqJ2wPdy1QDK6NBIw7pQatyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)