UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RSr+wZwYzVdCEN5jC4HkuGCK4eit+usTucT/ndZbZ14=' 
WHERE 
  key_id = '1a971f5961adc5b5c0d21c6cf338ee4e9908171fd45a22a108f2ba2190453ac9' 
  AND (
    token = 'RSr+wZwYzVdCEN5jC4HkuGCK4eit+usTucT/ndZbZ14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043