UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5Kb8UoduOfD43Ze6xD0kFdkRuwmM6EfselhbvIffkP8='
WHERE
key_id = 'da698042b45142e649866e3202d090fca9235751436c776d70c180060e33bdc9'
AND (
token = '5Kb8UoduOfD43Ze6xD0kFdkRuwmM6EfselhbvIffkP8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)