UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NHreYXLES1seXjPOkT3+za+xg8tI2/RjV8Ms/svuDtI='
WHERE
key_id = 'fd271670ecb09bdd2b4508df6f8cb212043fbc23c7fb4d0895362a5223a49f85'
AND (
token = 'NHreYXLES1seXjPOkT3+za+xg8tI2/RjV8Ms/svuDtI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)