UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i/Z6WdRyf8Bia0i4bBm7JEF2cyfVTJeEoTqVLaLd3g8=' 
WHERE 
  key_id = '4e4b26996023145dbfb0ff245ae3917f67e747f85c2afe700ff2a940ae461be9' 
  AND (
    token = 'i/Z6WdRyf8Bia0i4bBm7JEF2cyfVTJeEoTqVLaLd3g8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043