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