UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ulTQK667JHBsHcJ53HMkiS+hD24I4495aMsA9c94YVg='
WHERE
key_id = 'a40b032fbf9c5df5cb997bd79e415b390f7fce661a9e55a6b0106b51ec4d12b6'
AND (
token = 'ulTQK667JHBsHcJ53HMkiS+hD24I4495aMsA9c94YVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)