UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hi+o6mE13YvWEqNrl1FaDN8AOjpv0mf/vmHfn7GV1UU=' 
WHERE 
  key_id = '1ba638eb568f8f082026176bdd512d53c8ecf3437e8955ef6dfe45117ca174dc' 
  AND (
    token = 'hi+o6mE13YvWEqNrl1FaDN8AOjpv0mf/vmHfn7GV1UU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039