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