UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hRt6yKjiOgvIe1gkiZDmqy50kOt08Mrb4Drha/u6NJo='
WHERE
key_id = '8b1948f0bc01b663442bf6d9700881f66525d150496bc120eb0cde2bcc72b41b'
AND (
token = 'hRt6yKjiOgvIe1gkiZDmqy50kOt08Mrb4Drha/u6NJo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)