UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B1t/0VMAr9cfFaCDL/Qp1ijPKciDr0R/B95oE1sf5xs=' 
WHERE 
  key_id = 'bb0786857c06a4470d6dec960a5fc795bc3fdc0b7757d1bc44f0a39df03f57da' 
  AND (
    token = 'B1t/0VMAr9cfFaCDL/Qp1ijPKciDr0R/B95oE1sf5xs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039