UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HNUWiokbC/MID2dKf7IUolENlfpTTvsVJFKDNn4THA0=' 
WHERE 
  key_id = 'd3ecee122207a85fac942ccc5ae7421f7bdba9c57a9f615b3696229f6ea5ad64' 
  AND (
    token = 'HNUWiokbC/MID2dKf7IUolENlfpTTvsVJFKDNn4THA0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023