UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TX2mmkiW6Py3TlpnYml1FRQtdJjuCzWPFp9Jy7mkXfs='
WHERE
key_id = '2a52756290336875006141731d78449073b2f039c29682a271024c1bac1a24cd'
AND (
token = 'TX2mmkiW6Py3TlpnYml1FRQtdJjuCzWPFp9Jy7mkXfs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)