UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S93mNHnuRhBd8H2bdFqzszkvUP1W5Q8RaKXlhXlWYoA='
WHERE
key_id = '104e7d2ae3932924f3e80f4e15bd6362eb0b3529619153a8de0766f13a56d919'
AND (
token = 'S93mNHnuRhBd8H2bdFqzszkvUP1W5Q8RaKXlhXlWYoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)