UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o6C55fuVcGE57N7I5f0q1vodCCTf6AI7f1Aj3MidGe0=' 
WHERE 
  key_id = '757ff8d76129a0c216f928180bed27d8076dc0b18486dc71eca670de6b2df2f3' 
  AND (
    token = 'o6C55fuVcGE57N7I5f0q1vodCCTf6AI7f1Aj3MidGe0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019