UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W+yP2jt0VWcL4lTwtG3rQGUafCz7KxKFn5wsKDRe4/8=' 
WHERE 
  key_id = 'b087f9067c44f3b06e6fe97820f590b7ea10899a2283620a1eb076e25db051ad' 
  AND (
    token = 'W+yP2jt0VWcL4lTwtG3rQGUafCz7KxKFn5wsKDRe4/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018