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

Query time 0.00034