UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sw2G6TMIxG5mNjfJRb4Xd6qHcUfhfuaNxhpbufzVABg=' 
WHERE 
  key_id = 'cd1410d004247043fd7d10902b8438f64c12e2d32194f6a75624c59637032696' 
  AND (
    token = 'Sw2G6TMIxG5mNjfJRb4Xd6qHcUfhfuaNxhpbufzVABg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051