UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iGjTeUhPFLmRx+dcWb54X1V77ER/tTw+ci4bv3AtPRQ='
WHERE
key_id = 'a94e90a86e50ec4b4381e7e37c4d6680872e83afa011d158704063edf770bb3d'
AND (
token = 'iGjTeUhPFLmRx+dcWb54X1V77ER/tTw+ci4bv3AtPRQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)