UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OtiiRXhgGfEmfIH8cvb9HkP5f6d49oo1039dTMQJ3Go='
WHERE
key_id = '8f1645dd6cb79a0d7e6f7a0c4ce289f41ef700cc3e7c5c0ad8228fb5fc04a715'
AND (
token = 'OtiiRXhgGfEmfIH8cvb9HkP5f6d49oo1039dTMQJ3Go='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)