UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vxN3tYSwjHjsHqO4vjKGK7PJ1tR4W1RMj+BVoKynIi8=' 
WHERE 
  key_id = '9a0ff285bb2330c629a1ca023e7f5b60a788f58a836bd974515a94532cb0edc2' 
  AND (
    token = 'vxN3tYSwjHjsHqO4vjKGK7PJ1tR4W1RMj+BVoKynIi8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033