UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c5oBoR4/dud0MfSnzt35P+zHACG0sX4wM0aktKLGSis=' 
WHERE 
  key_id = '96729ee2961d110e1d8e6dd8ac229f582e657d6ecf629b8f7f2a034c9e9373b6' 
  AND (
    token = 'c5oBoR4/dud0MfSnzt35P+zHACG0sX4wM0aktKLGSis=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032