UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'msqXNqaRikTSe3/NrOEglrcty+CpVJWJMC4LbxWgu1c=' 
WHERE 
  key_id = 'fb7e77b07350768a78c18a3c2fa07bb82eee18bbf5f9d57d0bec44971ac95f3d' 
  AND (
    token = 'msqXNqaRikTSe3/NrOEglrcty+CpVJWJMC4LbxWgu1c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050