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