UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K7D5tCbOXelMnwWKyhdGunZAK4P6UImonjcMDzd7C9Y=' 
WHERE 
  key_id = '7118bb0532d40992c3e64967cbd1493c366c5de998abce6aa13612d709d86fa3' 
  AND (
    token = 'K7D5tCbOXelMnwWKyhdGunZAK4P6UImonjcMDzd7C9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037