UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TjMWvCJ27Id6TRfCzfrVKciPLT8oTkH01WdhHuLdM78='
WHERE
key_id = '985de8c0a17e29218dbfb9094c6aab8ba33bb2b6c96307193e47539c63ed6b07'
AND (
token = 'TjMWvCJ27Id6TRfCzfrVKciPLT8oTkH01WdhHuLdM78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)